<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>计时器(timeout)</title>
	</head>
	<body>
		10秒后跳转...<span id="t">10</span>
		<script type="text/javascript">
			var s=10;
			var timer=setInterval(function () {
				s--;
				document.getElementById("t").innerText=s;
				if(s==0){
					clearInterval(timer);
					location.href="http://baidu.com";
				}
			},1000);
			
		</script>
	</body>
</html>
